<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .nav {
            width: 700px;
            height: 60px;
            background-color: black;
            margin: 0 auto;
        }

        .maps {
            width: 700px;
            text-align: center;
        }

        .maps img {
            width: 80%;
            margin-top: 30px;
        }

        .nav li {
            width: 100px;
            height: 60px;
            /*border: 1px solid yellow;*/
            float: left;
            position: relative;
            overflow: hidden;
        }

        .nav a {
            position: absolute;
            width: 100%;
            height: 100%;
            font-size: 24px;
            color: blue;
            text-align: center;
            line-height: 60px;
            text-decoration: none;
            z-index: 2;
        }

        .nav span {
            position: absolute;
            width: 100%;
            height: 100%;
            background-color: yellow;
            top: 60px;
        }
    </style>
    <script src="../js/jquery-1.12.4.js"></script>
</head>

<body>
    <div class="nav">
        <ul>
            <li>
                <a href="javascript:void(0);">导航1</a>
                <span></span>
            </li>
            <li><a href="javascript:void(0);">导航2</a><span></span></li>
            <li><a href="javascript:void(0);">导航3</a><span></span></li>
            <li><a href="javascript:void(0);">导航4</a><span></span></li>
            <li><a href="javascript:void(0);">导航5</a><span></span></li>
            <li><a href="javascript:void(0);">导航6</a><span></span></li>
            <li><a href="javascript:void(0);">导航7</a><span></span></li>
        </ul>
        <div class="maps">
            <img src="1.jpg" alt="">
        </div>
        <div class="mp3">
            <audio src="mp3/1.mp3"></audio>
            <audio src="mp3/2.mp3"></audio>
            <audio src="mp3/3.mp3"></audio>
            <audio src="mp3/4.mp3"></audio>
            <audio src="mp3/5.mp3"></audio>
            <audio src="mp3/6.mp3"></audio>
            <audio src="mp3/7.mp3"></audio>
        </div>
    </div>
    <script>
        $(function () {
            let $lis = $('li')
            let $audios = $('audio')
            $lis.on('mouseenter', function () {
                let index = $(this).index();
                // console.log(index);
                $(this).children('span').stop().animate({ top: 0 })
                $audios[index].load()
                $audios[index].play()
            })

            $lis.on('mouseleave', function () {
                // console.log(index);
                $(this).children('span').stop().animate({ top: 60 })
            })
            $(window).on('keydown', function (e) {
                // console.log(e.keyCode);
                if (97 <= e.keyCode <= 103) {
                    $lis.eq(e.keyCode - 97).mouseenter()
                }
            })
            $(window).on('keyup', function (e) {
                // console.log(e.keyCode);
                if (97 <= e.keyCode <= 103) {
                    $lis.eq(e.keyCode - 97).mouseleave()
                }
            })
        })
    </script>
</body>

</html>